﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

namespace Prototype
{
    internal class UnderlinePen : IProduct
    {
        private char ulchar;
        public UnderlinePen(char ulchar)
        {
            this.ulchar = ulchar;
        }

        public object Clone()
        {
            return this.MemberwiseClone();
        }

        public IProduct CreateClone()
        {
            IProduct p = null;
            try
            {
                p = (IProduct)Clone();
            }
            catch (NotSupportedException e)
            {
                Console.WriteLine(e.StackTrace);
            }
            return p;
        }

        public void Use(string s)
        {
            var length = Encoding.UTF8.GetBytes(s).Length;
            Console.WriteLine($"\"{s}\"");
            Console.Write(" ");
            for (var i = 0; i < length; i++)
            {
                Console.Write(ulchar);
            }
            Console.WriteLine();
        }
    }
}
